T4U AC1200 on nixOS (Linux, WiFi USB Dongle)
So I am in the process of removing all my wires, because I need to pack them up for the move, but I still needed internet on my nixOS Desktop machine. So I found my "old" TP Link T4U AC1200, was not sure whether it still works. It was on another PC that got used infrequently and had Windows 10 on it.
So I tried plugging it into my nixOS desktop. Nothing happened (there is small LED on the stick). Welp. Linux moment... or was the hardware defect?
The other PC was already unplugged and not in reach. So I started looking into the model.
First I checked whether it's actually being recognized by Linux:
$ nix-shell -p usbutils
$ lsusb
> Bus 001 Device 004: ID 2357:0101 TP-Link RTL8812AU Archer T4U 802.11ac
There it was and according to "the internet" the ID did not identify it as storage/optical-drive device. Apparently that is a thing that can happen.
The interesting part is RTL8812AU. This is the name of the chipset (?) the stick is built with. I think RTL stands for Realtek.
I did some "research" on how well this chipset is supported. The following two kind of things were what I found:
- There are custom installer github repos for related drivers, but this seemed like the wrong option for me
- A statement that with kernel 6.12+ that chipset is in-tree(?) by default
(1) was not an option for me. I am not using nixOS to then have random shell script installers mess with the system. (2) I interpreted at first as "this should already work", but it turned out I had to adjust my hardware-configuration.nix.
Relevant part:
boot.kernelModules = [ "kvm-intel" "8812au" ];
boot.extraModulePackages = [ config.boot.kernelPackages.rtl8812au ];
And in my regular configuration.nix I added the following which is supposed to allow for hybrid usage, preferring wired over wireless:
networking.networkmanager.settings = {
connection = {
# Lower metric for Ethernet (higher priority)
"ethernet.route-metric" = 10;
# Higher metric for WiFi (lower priority, fallback)
"wifi.route-metric" = 600;
};
};
I also added the WiFi connection in advance using nmtui. And wpa_supplicant. Which is very redundant I think.
Checking the following helps. If it's running but there is no indication of anything going on, "you are missing something". I won't go much into detail regarding the wpa_supplicant
part, because the available documentation is rather good and I think it's straight forward.
journalctl -u wpa_supplicant
Now comes the final and very important ingredient: nixos-rebuild boot and reboot.
I think switch did not activate the kernel module or did not restart the appropriate systemd related services automatically to make it work without reboot. I am pretty sure there is a way to make it work, but I think the "plain" nixOS switch activation script does not do it for you.